import request from '@/utils/request'

/**
 * 生成订单
 * @returns Promise
 */
export const payOut = () => {
    return request('/member/order/pre','get')
}
/**
 * 添加收获地址
 * @returns Promise
 */
export const AddAddress = (address) => {
    return request('/member/address','post', address)
}
/**
 * 修改收货地址
 * @param {*} form 
 * @returns 
 */
export const EditAddress = (form) => {
    return request(`/member/address/${form.id}`,'put',form)
} 
/**
 * 提交订单
 * @param {*} params 
 * @returns 
 */
export const submitOrder = (params) => {
    return request('/member/order','post', params)
}
/**
 * 订单详情
 * @param {*} id 
 * @returns 
 */
export const getOrderDetail = (orderId) => {
    return request(`/member/order/${orderId}`,'get')
}
/**
 * 订单列表
 * @param {*} param
 * @returns 
 */
export const findOrderList = ({page,pageSize,orderState}) => {
    return request('/member/order','get',{page,pageSize,orderState})
}
/**
 * 取消订单
 * @param {*} id 
 * @param {*} cancelReason 
 * @returns 
 */
export const CancelOrder = (id,cancelReason) => {
    return request(`/member/order/${id}/cancel`,'put', { id, cancelReason })
}
/**
 * 删除订单
 * @param {string} ids 
 * @returns 
 */
export const delOrder = (ids) => {
    return request('/member/order','delete', {ids})
}
/**
 * 确认收货
 * @param { Number } id 
 * @returns 
 */
export const confirmOrder = (id) => {
    return request(`/member/order/${id}/receipt`,'put')
}
/**
 * 查看物流
 * @param {*} id 
 * @returns 
 */
export const lookLogistic = (id) => {
    return request(`/member/order/${id}/logistics`,'get')
}
